﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using MyBlog.DataEntity;

namespace MyBlog.DataAccessInterface
{
    public interface IContext
    {
        void Add<T>(T entity) where T : class;

        void AddRange<T>(IEnumerable<T> entities) where T : class;

        void Update<T>(T entity) where T : class;

        void Detached<T>(T entity) where T : class;

        void Delete<T>(params object[] primaryKey) where T : class;

        void Delete<T>(Expression<Func<T, bool>> keySelector) where T : class;

        void DeleteRange<T>(IEnumerable<T> entities) where T : class;

        T Get<T>(params object[] primaryKey) where T : class;

        T Get<T>(Expression<Func<T, bool>> keySelector) where T : class;

        List<T> GetAll<T>(bool isTracking = true) where T : class;

        List<T> GetAll<T>(Expression<Func<T, bool>> keySelector, bool isTracking = true) where T : class;

        List<T> GetAll<T>(Expression<Func<T, bool>> keySelector, int page, int size, out int total, bool isTracking = true) where T : class;

        List<T> SqlQuery<T>(string sql, params object[] prms) where T : class;

        int ExcuateSql(string sql, params object[] prms);

        DbSet<Tbl_Account> Tbl_Account { get; }
        DbSet<Tbl_Album> Tbl_Album { get; }
        DbSet<Tbl_AlbumDetail> Tbl_AlbumDetail { get; }
        DbSet<Tbl_Article> Tbl_Article { get; }
        DbSet<Tbl_ArticleComment> Tbl_ArticleComment { get; }
        DbSet<Tbl_Category> Tbl_Category { get; }
        DbSet<Tbl_Header> Tbl_Header { get; }
        DbSet<Tbl_Message> Tbl_Message { get; }
        DbSet<Tbl_Mood> Tbl_Mood { get; }
        DbSet<Tbl_MoodComment> Tbl_MoodComment { get; }
        DbSet<Tbl_MsgReply> Tbl_MsgReply { get; }
        DbSet<Tbl_PicComment> Tbl_PicComment { get; }
        DbSet<Tbl_SysLog> Tbl_SysLog { get; }
        DbSet<Tbl_Visitor> Tbl_Visitor { get; }

        DbSet<Tbl_SysHistory> Tbl_SysHistory { set; get; }

        DbSet<Tbl_Words> Tbl_Words { set; get; }

        DbSet<Tbl_WordComment> Tbl_WordComment { set; get; }

        DbSet<Tbl_SysInfo> Tbl_SysInfo { set; get; }
    }
}
